home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolkit / vbof_v11 / demointr.frm < prev    next >
Text File  |  1996-03-03  |  20KB  |  383 lines

  1. VERSION 4.00
  2. Begin VB.Form Intro 
  3.    Caption         =   "VB Object Framework - Integrated OO Architecture for VB4"
  4.    ClientHeight    =   5760
  5.    ClientLeft      =   330
  6.    ClientTop       =   765
  7.    ClientWidth     =   8745
  8.    Height          =   6180
  9.    Left            =   270
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   5760
  12.    ScaleWidth      =   8745
  13.    Top             =   405
  14.    Width           =   8865
  15.    Begin VB.CommandButton Command8 
  16.       Caption         =   "OO-based Unbound ListBox Demo"
  17.       Height          =   495
  18.       Left            =   4440
  19.       TabIndex        =   2
  20.       Top             =   4800
  21.       Width           =   2055
  22.    End
  23.    Begin VB.CommandButton Command7 
  24.       Caption         =   "OO-based Unbound DBGrid Demo"
  25.       Height          =   495
  26.       Left            =   2280
  27.       TabIndex        =   1
  28.       Top             =   4800
  29.       Width           =   2055
  30.    End
  31.    Begin VB.TextBox lblDescription 
  32.       ForeColor       =   &H00C00000&
  33.       Height          =   2055
  34.       Left            =   120
  35.       MultiLine       =   -1  'True
  36.       ScrollBars      =   2  'Vertical
  37.       TabIndex        =   12
  38.       TabStop         =   0   'False
  39.       Top             =   2160
  40.       Width           =   8535
  41.    End
  42.    Begin VB.CommandButton Command6 
  43.       Caption         =   "VBOFCollection"
  44.       Height          =   375
  45.       Left            =   5880
  46.       TabIndex        =   7
  47.       Top             =   1680
  48.       Width           =   2775
  49.    End
  50.    Begin VB.CommandButton Command5 
  51.       Caption         =   "VBOFEventManager"
  52.       Height          =   375
  53.       Left            =   3000
  54.       TabIndex        =   6
  55.       Top             =   1680
  56.       Width           =   2775
  57.    End
  58.    Begin VB.CommandButton Command4 
  59.       Caption         =   "VBOFObjectManager"
  60.       Height          =   375
  61.       Left            =   120
  62.       TabIndex        =   5
  63.       Top             =   1680
  64.       Width           =   2775
  65.    End
  66.    Begin VB.CommandButton Command3 
  67.       Cancel          =   -1  'True
  68.       Caption         =   "Cancel"
  69.       Height          =   375
  70.       Left            =   6600
  71.       TabIndex        =   4
  72.       Top             =   5400
  73.       Width           =   2055
  74.    End
  75.    Begin VB.CommandButton Command2 
  76.       Caption         =   "Kinda-OO-based DataControl Demo"
  77.       Height          =   495
  78.       Left            =   6600
  79.       TabIndex        =   3
  80.       Top             =   4800
  81.       Width           =   2055
  82.    End
  83.    Begin VB.CommandButton Command1 
  84.       Caption         =   "Create Demo Objects"
  85.       Default         =   -1  'True
  86.       Height          =   495
  87.       Left            =   120
  88.       TabIndex        =   0
  89.       Top             =   4800
  90.       Width           =   2055
  91.    End
  92.    Begin VB.Label Label2 
  93.       Caption         =   "Click a button below for information about these objects and how they contrinute to the VBFrameWork:"
  94.       Height          =   255
  95.       Index           =   2
  96.       Left            =   120
  97.       TabIndex        =   11
  98.       Top             =   1440
  99.       Width           =   7575
  100.    End
  101.    Begin VB.Label Label2 
  102.       Caption         =   $"DemoIntr.frx":0000
  103.       Height          =   495
  104.       Index           =   1
  105.       Left            =   120
  106.       TabIndex        =   10
  107.       Top             =   840
  108.       Width           =   8535
  109.    End
  110.    Begin VB.Label Label2 
  111.       Caption         =   $"DemoIntr.frx":00E1
  112.       Height          =   495
  113.       Index           =   0
  114.       Left            =   120
  115.       TabIndex        =   9
  116.       Top             =   4320
  117.       Width           =   8535
  118.    End
  119.    Begin VB.Label Label1 
  120.       Caption         =   $"DemoIntr.frx":017A
  121.       Height          =   615
  122.       Left            =   120
  123.       TabIndex        =   8
  124.       Top             =   120
  125.       Width           =   8415
  126.    End
  127. End
  128. Attribute VB_Name = "Intro"
  129. Attribute VB_Creatable = False
  130. Attribute VB_Exposed = False
  131. Option Explicit
  132.  
  133. Public ObjectManager As VBOFObjectManager
  134. Private tempString As String
  135. Private Sub Form_Load()
  136.     
  137.     Dim tempString As String
  138.  
  139.         tempString = "(c) 1996 Ken Fitzpatrick"
  140.     tempString = tempString & vbCrLf & _
  141.                     "The VB Object Framework and this demonstration package are provided on an as-is, use-at-your-own-risk basis."
  142.     tempString = tempString & vbCrLf & _
  143.                     vbCrLf & _
  144.                     "Even though thorough testing has been performed on this product and demonstration package and every resonable precaution has been taken, the author assumes no responsibilities of any actions or damages which result from the use of this product or demonstration package."
  145.     tempString = tempString & vbCrLf & _
  146.                     vbCrLf & _
  147.                     "The above statement is necessary because the very nature of VB Object Framework is to manipulate data in the form of objects.  Under certain circumstances, particularly under situations of misuse or where the user is unfamiliar the product, it would be possible to damage or destroy data.  The author cannot, and will not, be responsible for such use of this product or demonstration package."
  148.     lblDescription = tempString
  149.  
  150. End Sub
  151.  
  152. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  153.  
  154.     ObjectManager.Form_QueryUnload _
  155.         Me
  156.  
  157. #If NoEventMgr = False Then
  158.     ObjectManager. _
  159.         UnRegisterForAllEvents _
  160.         RegisterObject:=Me
  161. #End If
  162.  
  163. End Sub
  164.  
  165.  
  166. Private Sub Command1_Click()
  167.         
  168.     Dim tempString As String
  169.     
  170.     Me.MousePointer = vbArrowHourglass
  171.     
  172.     tempString = "Creating test data now . . ."
  173.     tempString = tempString & vbCrLf & _
  174.                     vbCrLf & _
  175.                     "Puzzle:  " & vbCrLf & _
  176.                     "- Why does Martha Washington's Person information display only in demonstration sessions where the 'Create Demo Objects' button has been clicked earlier in that session (versus running the demonstration and going directly to one of the display-oriented windows)?" & vbCrLf & _
  177.                     "- How does this impact the ability to display personal information about Goerge Washington? "
  178.     tempString = tempString & vbCrLf & _
  179.                     vbCrLf & _
  180.                     "Hint words:  " & vbCrLf & _
  181.                     "Object persistence, Person object 'Martha'"
  182.     lblDescription = tempString
  183.     DoEvents
  184.     
  185.     BOMTestScript
  186.     
  187.     Me.MousePointer = vbArrow
  188.  
  189.     Command7.SetFocus
  190. End Sub
  191.  
  192.  
  193. Private Sub Command2_Click()
  194.  
  195.     Me.MousePointer = vbArrowHourglass
  196.     
  197.     publicCompany.Persons.Refresh
  198.  
  199. ' pass-along the ObjectManager
  200.     Set CustomerDetailsDataControl.ObjectManager = _
  201.         ObjectManager
  202.     Set EventMessages.ObjectManager = _
  203.         ObjectManager
  204.  
  205. #If NoEventMgr = False Then
  206.     EventMessages.Show
  207. #End If
  208.  
  209.     CustomerDetailsDataControl.Show
  210.     
  211.     Me.MousePointer = vbArrow
  212. End Sub
  213.  
  214.  
  215. Private Sub Command3_Click()
  216.     Me.MousePointer = vbArrowHourglass
  217.     
  218.     tempString = "(c) 1996 Ken Fitzpatrick"
  219.     tempString = tempString & vbCrLf & _
  220.                 "Removing all Collections and Objects . . ."
  221.     lblDescription = tempString
  222.     DoEvents
  223.     
  224.     ObjectManager.CompleteObjectCleanUp
  225.     
  226.     Me.MousePointer = vbArrow
  227.     End
  228. End Sub
  229.  
  230. Private Sub Command4_Click()
  231.     Dim tempString As String
  232.     
  233.     tempString = "(c) 1996 Ken Fitzpatrick"
  234.     tempString = tempString & vbCrLf & _
  235.                     "The VBOFObjectManager functions as a governing entity, overseeing all object-oriented implementations of the VBOF.  "
  236.     tempString = tempString & vbCrLf & _
  237.                     vbCrLf & _
  238.                     "VBOFObjectManager has the following characteristics:" & vbCrLf & _
  239.                     " - it works in conjunction with the VBOFEventManager to deliver event notifications to registered objects;" & vbCrLf & _
  240.                     " - it works in conjunction with the application to instantiate new contained objects (e.g., Person.Mother, Employee.Manager, etc.) and new VBOFCollections (e.g., Person.Addresses, Order.Items, etc.) from a Database Table or a RecordSet object;" & vbCrLf & _
  241.                     " - it ensures that no given object is ever instantiated more than once, thus avoiding those ideosynchracies which arise when multiple instances of a given object are found to exist."
  242.     tempString = tempString & vbCrLf & _
  243.                     vbCrLf & _
  244.                     "To evalute the impact of VBOFObjectManager, please refer to the 'BOMTestScript' method of the 'DemoVBObjectFramework' (DemoVBFW.BAS) file.  " & _
  245.                     "Another means is to open the two demo windows via the 'Pure OO Demo (DBGrid)' and 'Pure OO Demo (ListBox)' buttons.  From either window, change any item and click the 'Update' button, then observe the same object on the other window.  " & _
  246.                     "Since both windows reference the identical objects, the change is reflected in both places simultaneously.  For additional information about reflecting dynamically changing object properties across the application, please refer to the description of the VBOFEventManager." & _
  247.                     vbCrLf & vbCrLf & _
  248.                     "Also, notice that these windows display 'rich' information in the lower viewing pane as the mouse passes over the person's name and address areas.  This information is considered 'rich' because, for example, the person object knows who its Spouse, Mother or Father are;  addresses know the Capitay City of its state.  " & _
  249.                     "These items are not typically available in 'non-rich' environments, because, quite simply, only object-oriented techniques bring this type of power to the application developer.  The VBOFObjectManager supports the enriched environment by supporting contained (i.e., 'imbedded') objects."
  250.     tempString = tempString & vbCrLf & _
  251.                     vbCrLf & _
  252.                     "To create an instance of VBOFObjectManager, please refer to the 'PopulateObjectManager' method of the 'TestVBOFObjectManager' (DemoVBFW.BAS) file or the VBOF User's Guide."
  253.     tempString = tempString & vbCrLf & _
  254.                     vbCrLf & _
  255.                     "VBOFObjectManager supports a dynamic 'DebugMode', where all of the important decisions and operations by VBOF are logged to the VB Immediate Window.  After thoroughly testing an application, the execution speed of the application code can be enhanced slightly by disabling the code which dynamically checks for 'DebugMode' being in effect simply by specifying the conditional compilation string: 'NoDebugMode = -1' (without the apostrophes.)"
  256.     lblDescription = tempString
  257. End Sub
  258.  
  259.  
  260. Private Sub Command5_Click()
  261.     Dim tempString As String
  262.     
  263.     tempString = "(c) 1996 Ken Fitzpatrick"
  264.     tempString = tempString & vbCrLf & _
  265.                     "The VBOFEventManager implements a system-wide event-management scheme, where any object can trigger events and any other object can be notified of the event."
  266.     tempString = tempString & vbCrLf & _
  267.                     vbCrLf & _
  268.                     "This can be very useful for performing automatic 'backgound' functions without having to include the notification mechanisms within the generating application."
  269.     tempString = tempString & vbCrLf & _
  270.                     vbCrLf & _
  271.                     "For example, upon changing a customer's DateOfBirth, it might be necessary to recompute any applicable life insurance premiums, or upon learning of the birth of a child, " & _
  272.                     "it might be company policy to mail a note of congratulations.  The optimum means of supporting these functions is to have them processed automatically and " & _
  273.                     "independently of the original application, via an event management system.  " & _
  274.                     "To support these objectives in the most concise and maintainable manner, the original application should simply trigger events for which the peripheral applications can register and process accordingly.  This also alleviates the need for the original application to absorb the responsibility of specifically notifying each of the interested tasks of any such changes."
  275.     tempString = tempString & vbCrLf & _
  276.                     vbCrLf & _
  277.                     "But perhaps the most useful purpose for the VBOFEventManager is to facilitate the separation of responsibilities between the GUI and the BOM.  " & _
  278.                     "Such a separation facilitates the design and implementation of a non-visual BOM, and the eventual addition of the GUI.  " & _
  279.                     "The BOM objects can then trigger events which are processed by the GUI and vice versa.  Under this object-oriented scheme, any necessary processing is conducted by the BOM, then the GUI merely presents the processed data on the screen."
  280.     tempString = tempString & vbCrLf & _
  281.                     vbCrLf & _
  282.                     "VBOFEventManager performs the following:" & vbCrLf & _
  283.                     " - accepts object event registrations;" & vbCrLf & _
  284.                     " - monitors events being triggered" & vbCrLf & _
  285.                     " - sends event notifications to registered objects."
  286.     tempString = tempString & vbCrLf & _
  287.                     vbCrLf & _
  288.                     "Events can be triggered by any object, not just these 'VBOF' objects." & vbCrLf
  289.     tempString = tempString & vbCrLf & _
  290.                     "Events can be named anything, such as 'Changed', 'Added', 'Deleted', 'Disqualified', etc." & vbCrLf
  291.     tempString = tempString & vbCrLf & _
  292.                     "Event Notification occurs for any object which has registered for the current event (by 'EventType:='), the current object type (by 'ObjectType:=') or for a specific object instance (by 'ObjectID:=') as determined by its ObjectID property."
  293.     tempString = tempString & vbCrLf & _
  294.                     vbCrLf & _
  295.                     "Event Notification can be completely disabled and the associated .CLS files safely removed from a VB Project simply by specifying the conditional compilation string: 'NoEventMgr = -1' (without the apostrophes.)"
  296.     tempString = tempString & vbCrLf & _
  297.                     vbCrLf & _
  298.                     "For the coolest example of the VBOFEventManager's capabilities, try the following:" & vbCrLf & _
  299.                     " - Start both of the 'Pure OO' demos by clicking the 'Pure OO Demo (DBGrid)' button and the 'Pure OO Demo (ListBox)' button, below;" & vbCrLf & _
  300.                     " - Arrange both windows to be able to observe them both simultaneously;" & vbCrLf & _
  301.                     " - Select the corresponding object in both windows (e.g., click on 'Bill Clinton' in the list-area of both of the windows);" & vbCrLf & _
  302.                     " - Change a given attribute of that object (e.g., change Bill's First Name field to 'First Dude'), then click the 'Update' button;" & vbCrLf & _
  303.                     " - Watch in amazement as the other window instantly reflects the corresponding change."
  304.     tempString = tempString & vbCrLf & _
  305.                     "This represents the type of interaction that Event Management can facilitate between the non-visual BOM and the GUI as the GUI is being developed 'over' the BOM."
  306.     tempString = tempString & vbCrLf & _
  307.                     vbCrLf & _
  308.                     "For other examples of the VBOFEventManager's capabilities, try the following (followed by clicking the respective 'Update' button), then watch the 'Event Messages' window for the results:" & vbCrLf & _
  309.                     " - Adjust the Customer's Date of Birth (by a decade, or so).  This triggers a simulated product cross-selling facility to meet the changing needs of the customer throughout his life.  Running as a separate 'background' task, the product cross-selling facility does not have to impose its specific requirements upon the customer maintenance program, which keeps both programs 'clean' and highly maintainable;" & vbCrLf & _
  310.                     " - Adjust the Address, but don't use 'Suite' in any of the 'Lines'.  This triggers a simulated address validation which asks the user to ensure that the missing 'Suite' value in the updated address is correct;" & vbCrLf & _
  311.                     " - Adjust the Phone Number to something very short or very long.  This triggers a simulated phone number validation which asks the user if the unusual length of the phone number is correct."
  312.  
  313.     lblDescription = tempString
  314. End Sub
  315.  
  316.  
  317. Private Sub Command6_Click()
  318.     Dim tempString As String
  319.         
  320.     tempString = "(c) 1996 Ken Fitzpatrick"
  321.     tempString = tempString & vbCrLf & _
  322.                     "The VBOFCollection is a direct replacement for the VB4 Collection object, including '.Add'. '.Item' and '.Remove' methods, but adds several database-related capabilities, such as:" & vbCrLf & _
  323.                     " - automatically mapping database tables to objects;" & vbCrLf & _
  324.                     " - automatically generating all necessary SQL code to select data from the database and instantiate the appropriate objects;"
  325.     tempString = tempString & vbCrLf & _
  326.                     " - automatically providing object persistence;" & vbCrLf & _
  327.                     " - automatically implementing the object containment hierarchy;" & vbCrLf & _
  328.                     " - automatically interacting with other instances of VBOFCollection through the VBOFEventManager to synchronize knowledge of changes to common objects across multiple collections."
  329.     tempString = tempString & vbCrLf & _
  330.                     vbCrLf & _
  331.                     "Of course, VBOFCollection provides numerous methods which further support the application to this end."
  332.     tempString = tempString & vbCrLf & _
  333.                     vbCrLf & _
  334.                     "VBOFCollection can also be used to populate and assist in the processing of Grids, DBGrids, ListBoxes, ComboBoxes, etc. from collections of instantiated objects.  " & _
  335.                     "This facilitates a stronger object-oriented implementation of those GUI controls because when the user selects a given item from one of these, VBOFCollection returns to the application the associated object, not just a character string or a ListIndex value.  " & _
  336.                     "This allows the GUI to continue functioning in a conventional, procedural-oriented manner while the application and its BOM can function in an object-oriented manner."
  337.     lblDescription = tempString
  338. End Sub
  339.  
  340.  
  341. Private Sub Command7_Click()
  342.  
  343.     Me.MousePointer = vbArrowHourglass
  344.     
  345.     publicCompany.Persons.Refresh
  346.  
  347. ' pass-along the ObjectManager
  348.     Set CustomerDetailsDBGridNoDataControl.ObjectManager = _
  349.         ObjectManager
  350.     Set EventMessages.ObjectManager = _
  351.         ObjectManager
  352.  
  353.     EventMessages.Show
  354.     
  355.     CustomerDetailsDBGridNoDataControl.Show
  356.     
  357.     Me.MousePointer = vbArrow
  358.  
  359. End Sub
  360.  
  361.  
  362. Private Sub Command8_Click()
  363.  
  364.     Me.MousePointer = vbArrowHourglass
  365.     
  366.     publicCompany.Persons.Refresh
  367.  
  368. ' pass-along the ObjectManager
  369.     Set CustomerDetailsListBoxNoDataControl.ObjectManager = _
  370.         ObjectManager
  371.     Set EventMessages.ObjectManager = _
  372.         ObjectManager
  373.  
  374.     EventMessages.Show
  375.     
  376.     CustomerDetailsListBoxNoDataControl.Show
  377.     
  378.     Me.MousePointer = vbArrow
  379.  
  380. End Sub
  381.  
  382.  
  383.